package com.ruoyi.project.dict.dictspider.domain;

import com.ruoyi.common.utils.JsonUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;

/**
 * 汉典内容对象 zdic_spider
 *
 * @author shixiangwen
 * @date 2021-03-05
 */
public class ZdicSpider extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;

    private byte[] ziBytes;

    /**
     * 字
     */
    @Excel(name = "字")
    private String zi;

    /**
     * null
     */
    private String gycd;

    /**
     * null
     */
    private String swjz;

    /**
     * null
     */
    private String zyzx;

    /**
     * null
     */
    private String kxzd;

    /**
     * 国语词典
     */
    private String gycdFmt;

    /**
     * 说源解字
     */
    private String syjzFmt;

    private boolean gycdFlag;
    private boolean syjzFlag;
    private boolean kxzdFlag;

    private String swjzFmt;

    public String getSwjzFmt() {
        return swjzFmt;
    }

    public void setSwjzFmt(String swjzFmt) {
        this.swjzFmt = swjzFmt;
    }

    /**
     * 康熙字典
     */
    private String kxzdFmt;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setZi(String zi) {
        this.zi = zi;
    }

    public String getZi() {
        return zi;
    }

    public void setGycd(String gycd) {
        this.gycd = gycd;
    }

    public String getGycd() {
        return gycd;
    }

    public void setSwjz(String swjz) {
        this.swjz = swjz;
    }

    public String getSwjz() {
        return swjz;
    }

    public void setZyzx(String zyzx) {
        this.zyzx = zyzx;
    }

    public String getZyzx() {
        return zyzx;
    }

    public void setKxzd(String kxzd) {
        this.kxzd = kxzd;
    }

    public String getKxzd() {
        return kxzd;
    }

    public void setGycdFmt(String gycdFmt) {
        this.gycdFmt = gycdFmt;
    }

    public String getGycdFmt() {
        return gycdFmt;
    }

    public void setSyjzFmt(String syjzFmt) {
        this.syjzFmt = syjzFmt;
    }

    public String getSyjzFmt() {
        return syjzFmt;
    }

    public void setKxzdFmt(String kxzdFmt) {
        this.kxzdFmt = kxzdFmt;
    }

    public String getKxzdFmt() {
        return kxzdFmt;
    }

    public boolean isGycdFlag() {
        if (StringUtils.isEmpty(gycdFmt)) {
            return false;
        }
        List<Map> l = (List<Map>) JsonUtil.toListObject(gycdFmt, Map.class);
        if (CollectionUtils.isEmpty(l)) {
            return false;
        }
        return true;
    }

    public void setGycdFlag(boolean gycdFlag) {
        this.gycdFlag = gycdFlag;
    }

    public boolean isSyjzFlag() {
        if (StringUtils.isEmpty(syjzFmt)) {
            return false;
        }
        return true;
    }

    public void setSyjzFlag(boolean syjzFlag) {
        this.syjzFlag = syjzFlag;
    }

    public boolean isKxzdFlag() {
        if (StringUtils.isEmpty(kxzdFmt)) {
            return false;
        }
        return true;
    }

    public byte[] getZiBytes() {
        return ziBytes;
    }

    public void setZiBytes(byte[] ziBytes) {
        this.ziBytes = ziBytes;
    }

    public void setKxzdFlag(boolean kxzdFlag) {
        this.kxzdFlag = kxzdFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("zi", getZi()).append("gycd", getGycd()).append("swjz", getSwjz()).append("zyzx", getZyzx()).append("kxzd", getKxzd()).append("gycdFmt", getGycdFmt()).append("syjzFmt", getSyjzFmt()).append("kxzdFmt", getKxzdFmt()).toString();
    }
}
